package com.yihuier.yihuier.Service.MeetingManager;

import com.yihuier.yihuier.Entity.MeetingManager.MeetingCollection;
import com.yihuier.yihuier.Mapper.MeetingManager.MeetingCollectionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class MeetingCollectionService {


    @Autowired
    private MeetingCollectionMapper meetingCollectionMapper;

    public List<MeetingCollection> getCollectionMeetingIdAndTime(int user_id){
        return meetingCollectionMapper.selectCollectionIdAndTime(user_id);
    }

    /**
     * 查询单个会议收藏状态
     * */
    public String getCollectionStatusByUserIdAndMeetingId( int user_id,Long meeting_id){
        return meetingCollectionMapper.selectCollectionStatusByUserIdAndMeetingId(user_id,meeting_id);
    }

    /**
     * 收藏会议
     */
    public int addCollectMeeting(int user_id, int meeting_id, String collection_time) {
        return meetingCollectionMapper.insertCollectMeeting(user_id, meeting_id,collection_time);
    }

    /**
     * 得到收藏id
     */
    public String getCollectionIdByUserIdAndMeetingId(int user_id, int meeting_id) {
        return meetingCollectionMapper.selectCollection(user_id, meeting_id);
    }

    /**
     * 改变会议收藏状态
     */
    public int setCollectionStatus(String collection_id, int collection_status,String collection_time) {
        return meetingCollectionMapper.updateCollectionStatus(collection_id, collection_status,collection_time);
    }
}
